class EventEmitter {
  constructor() {
    this.events = {}
  }
  on(type, cb) {
    if (!this.events[type]) {
      this.events[type] = [cb]
    } else {
      this.events[type].push(cb)
    }
  }
  emit(type, a, b) {
    if (this.events[type]) {
      this.events[type].forEach(cb => {
        cb(a, b)
      })
    }
  }
}

export default EventEmitter